import { getEmpInfo } from '../../../../api/basic'
import { ref } from 'vue'

export default () => {
  // 获取职员信息加载
  const getEmpInfoLoading = ref(false)

  // 职员信息
  const empInfo = ref<DetailInfoEmployee | null>(null)

  /**
   * 获取职员信息方法
   * @param {String} id - 账号id
   * @param {String} empId - 职员id
   */
  const getEmpInfoFn = async (id: string, empId: string) => {
    getEmpInfoLoading.value = true
    const res = await getEmpInfo(id, empId)
    empInfo.value = res.data.data.row
    getEmpInfoLoading.value = false
  }

  return {
    empInfo,
    getEmpInfoLoading,
    getEmpInfoFn,
  }
}
